<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:c="http://java.sun.com/jsp/jstl/core"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:p="http://primefaces.org/ui"
	xmlns:pretty="http://ocpsoft.com/prettyfaces"
	xmlns:security="http://www.springframework.org/security/facelets/tags"
	xmlns:ui="http://java.sun.com/jsf/facelets">

<ui:composition>
	<security:isAuthenticated>
		<h:panelGroup
			rendered="#{not empty selectedPortfolioBean.selectedPortfolio}">
			<div class="box menu">
				<h2>
					<a href="#" id="toggle-main-menu"><h:outputText
							value="#{selectedPortfolioBean.selectedPortfolio.name}" /></a>
				</h2>
				<div class="block section-menu" id="main-menu">
					<ul class="section menu">
						<li><a class="menuitem"><h:outputText
									value="#{msg['mainMenu.quotes']}" /></a>
							<ul class="submenu">
								<li><pretty:link id="currentQuotationsLink"
										mappingId="currentQuotations"
										title="#{msg['mainMenu.ToolTip.currentQuotationsLink']}">
										<h:outputText value="#{msg['mainMenu.currentQuotations']}" />
									</pretty:link> <p:tooltip for="currentQuotationsLink" showEffect="fade"
										hideEffect="fade" /></li>
							</ul></li>
						<li><a class="menuitem"><h:outputText
									value="#{msg['mainMenu.details']}" /></a>
							<ul class="submenu">
								<li><pretty:link id="sharesLink"
										mappingId="portfolioShares"
										title="#{msg['mainMenu.ToolTip.sharesLink']}" >
										<h:outputText value="#{msg['mainMenu.shares']}" />
									</pretty:link> <p:tooltip for="sharesLink" showEffect="fade"
										hideEffect="fade" /></li>
							</ul></li>
						<li><a class="menuitem"><h:outputText
									value="#{msg['mainMenu.orders']}" /></a>
							<ul class="submenu">
								<li><pretty:link id="activeOrdersLink" mappingId="activeOrders"
										title="#{msg['mainMenu.ToolTip.activeOrdersLink']}">
										<h:outputText value="#{msg['mainMenu.activeOrders']}" />
									</pretty:link><p:tooltip for="activeOrdersLink" showEffect="fade"
										hideEffect="fade" /></li>
								<li><pretty:link id="archiveOrdersLink"
										mappingId="archiveOrders"
										title="#{msg['mainMenu.ToolTip.archiveOrdersLink']}">
										<h:outputText value="#{msg['mainMenu.archiveOrders']}" />
									</pretty:link>
									<p:tooltip for="archiveOrdersLink" showEffect="fade"
										hideEffect="fade" /></li>
							</ul></li>
						<li><a class="menuitem"><h:outputText
									value="#{msg['mainMenu.settings']}" /></a>
							<ul class="submenu">
								<li><pretty:link mappingId="changePortfolioName">
										<h:outputText value="#{msg['mainMenu.changeName']}" />
									</pretty:link></li>
							</ul></li>
					</ul>
				</div>
			</div>
		</h:panelGroup>


		<div class="box menu">
			<h2>
				<a href="#" id="toggle-portfolios"><h:outputText
						value="#{msg['mainMenu.mainMenu']}" /></a>
			</h2>
			<div class="block section-menu" id="portfolios">
				<ul class="section menu">
					<h:panelGroup
						rendered="#{security:ifAnyGranted('ROLE_ADMIN, ROLE_USER')}">
						<h:panelGroup
							rendered="#{portfolioListBean.numberOfPortfolios gt 0}">
							<li><a class="menuitem"> <h:outputFormat
										id="portoliosList"
										value="#{msg['mainMenu.portfolioSelection']}"
										title="#{msg['mainMenu.ToolTip.portfoliosList']}">
										<f:param value="#{portfolioListBean.numberOfPortfolios}" />
									</h:outputFormat> <p:tooltip for="portoliosList" showEffect="fade"
										hideEffect="fade" />
							</a>
								<ul class="submenu">
									<c:forEach var="portfolio"
										items="#{portfolioListBean.portfolios}" varStatus="rowCounter">
										<li><h:form>
												<h:commandLink
													action="#{portfolioListBean.selectPortfolio(rowCounter.index)}"
													value="#{portfolio.name}" />
											</h:form></li>
									</c:forEach>
								</ul></li>
						</h:panelGroup>

						<li><a class="menuitem"><h:outputText
									value="#{msg['mainMenu.userMenu']}" /></a>
							<ul class="submenu">
								<h:panelGroup
									rendered="#{portfolioListBean.howManyCanCreate gt 0}">
									<li><pretty:link mappingId="newPortfolio">
											<h:outputText value="#{msg['mainMenu.createNewPortfolio']}" />
										</pretty:link></li>
								</h:panelGroup>
								<li><pretty:link mappingId="changePassword">
										<h:outputText value="#{msg['mainMenu.changePassword']}" />
									</pretty:link></li>
							</ul></li>
					</h:panelGroup>
					<h:panelGroup rendered="#{security:ifAnyGranted('ROLE_ADMIN')}">
						<li><a class="menuitem"><h:outputText
									value="#{msg['mainMenu.adminMenu']}" /></a>
							<ul class="submenu">
								<li><pretty:link mappingId="userList">
										<h:outputText value="#{msg['mainMenu.userList']}" />
									</pretty:link></li>
								<li><pretty:link mappingId="indexCompanyList">
										<h:outputText value="#{msg['mainMenu.indexManagement']}" />
									</pretty:link></li>
							</ul></li>
					</h:panelGroup>
				</ul>
			</div>
		</div>
	</security:isAuthenticated>
</ui:composition>

</html>
